function overrideIO(){	
	gadgets.io = function(){
		var config = {};
		
		// 変更箇所
		var oauthState = {};
		// 元
		//var oauthState;
		
		function makeXhr(){
			var x;
			if (typeof shindig != "undefined" && shindig.xhrwrapper && shindig.xhrwrapper.createXHR) {
				return shindig.xhrwrapper.createXHR()
			}
			else {
				if (typeof ActiveXObject != "undefined") {
					x = new ActiveXObject("Msxml2.XMLHTTP");
					if (!x) {
						x = new ActiveXObject("Microsoft.XMLHTTP")
					}
					return x
				}
				else {
					if (typeof XMLHttpRequest != "undefined" || window.XMLHttpRequest) {
						return new window.XMLHttpRequest()
					}
					else {
						throw ("no xhr available")
					}
				}
			}
		}
		function hadError(xobj, callback){
			if (xobj.readyState !== 4) {
				return true
			}
			try {
				if (xobj.status !== 200) {
					var error = ("" + xobj.status);
					if (xobj.responseText) {
						error = error + " " + xobj.responseText
					}
					callback({
						errors: [error],
						rc: xobj.status,
						text: xobj.responseText
					});
					return true
				}
			} 
			catch (e) {
				callback({
					errors: [e.number + " Error not specified"],
					rc: e.number,
					text: e.description
				});
				return true
			}
			return false
		}
		function processNonProxiedResponse(url, callback, params, xobj){
			if (hadError(xobj, callback)) {
				return
			}
			var data = {
				body: xobj.responseText
			};
			callback(transformResponseData(params, data))
		}
		var UNPARSEABLE_CRUFT = "throw 1; < don't be evil' >";
		
		function processResponse(url, callback, params, xobj){
			if (hadError(xobj, callback)) {
				return
			}
			var txt = xobj.responseText;
			var offset = txt.indexOf(UNPARSEABLE_CRUFT) + UNPARSEABLE_CRUFT.length;
			if (offset < UNPARSEABLE_CRUFT.length) {
				return
			}
			txt = txt.substr(offset);
			var data = eval("(" + txt + ")");
			data = data[url];
			
			// 変更箇所
			if (data.oauthState && params && params.OAUTH_SERVICE_NAME) {
				oauthState[ params.OAUTH_SERVICE_NAME] = data.oauthState
			}
			// 元
			//if (data.oauthState) {
			//	oauthState = data.oauthState
			//}
			
			if (data.st) {
				shindig.auth.updateSecurityToken(data.st)
			}
			callback(transformResponseData(params, data))
		}
		function transformResponseData(params, data){
			var resp = {
				text: data.body,
				rc: data.rc || 200,
				headers: data.headers,
				oauthApprovalUrl: data.oauthApprovalUrl,
				oauthError: data.oauthError,
				oauthErrorText: data.oauthErrorText,
				errors: []
			};
			if (resp.rc < 200 || resp.rc >= 400) {
				resp.errors = [resp.rc + " Error"]
			}
			else {
				if (resp.text) {
					if (resp.rc >= 300 && resp.rc < 400) {
						params.CONTENT_TYPE = "TEXT"
					}
					switch (params.CONTENT_TYPE) {
						case "JSON":
						case "FEED":
							resp.data = gadgets.json.parse(resp.text);
							if (!resp.data) {
								resp.errors.push("500 Failed to parse JSON");
								resp.rc = 500;
								resp.data = null
							}
							break;
						case "DOM":
							var dom;
							if (typeof ActiveXObject != "undefined") {
								dom = new ActiveXObject("Microsoft.XMLDOM");
								dom.async = false;
								dom.validateOnParse = false;
								dom.resolveExternals = false;
								if (!dom.loadXML(resp.text)) {
									resp.errors.push("500 Failed to parse XML");
									resp.rc = 500
								}
								else {
									resp.data = dom
								}
							}
							else {
								var parser = new DOMParser();
								dom = parser.parseFromString(resp.text, "text/xml");
								if ("parsererror" === dom.documentElement.nodeName) {
									resp.errors.push("500 Failed to parse XML");
									resp.rc = 500
								}
								else {
									resp.data = dom
								}
							}
							break;
						default:
							resp.data = resp.text;
							break
					}
				}
			}
			return resp
		}
		function makeXhrRequest(realUrl, proxyUrl, callback, paramData, method, params, processResponseFunction, opt_contentType){
			var xhr = makeXhr();
			if (proxyUrl.indexOf("//") == 0) {
				proxyUrl = document.location.protocol + proxyUrl
			}
			xhr.open(method, proxyUrl, true);
			if (callback) {
				xhr.onreadystatechange = gadgets.util.makeClosure(null, processResponseFunction, realUrl, callback, params, xhr)
			}
			if (paramData !== null) {
				xhr.setRequestHeader("Content-Type", opt_contentType || "application/x-www-form-urlencoded");
				xhr.send(paramData)
			}
			else {
				xhr.send(null)
			}
		}
		function respondWithPreload(postData, params, callback){
			if (gadgets.io.preloaded_ && postData.httpMethod === "GET") {
				for (var i = 0; i < gadgets.io.preloaded_.length; i++) {
					var preload = gadgets.io.preloaded_[i];
					if (preload && (preload.id === postData.url)) {
						delete gadgets.io.preloaded_[i];
						if (preload.rc !== 200) {
							callback({
								rc: preload.rc,
								errors: [preload.rc + " Error"]
							})
						}
						else {
							// 変更箇所
							if (preload.oauthState && params && params.OAUTH_SERVICE_NAME) {
								oauthState[ params.OAUTH_SERVICE_NAME] = preload.oauthState;
							}
							// 元
							if (preload.oauthState) {
							//	oauthState = preload.oauthState
							}
							var resp = {
								body: preload.body,
								rc: preload.rc,
								headers: preload.headers,
								oauthApprovalUrl: preload.oauthApprovalUrl,
								oauthError: preload.oauthError,
								oauthErrorText: preload.oauthErrorText,
								errors: []
							};
							callback(transformResponseData(params, resp))
						}
						return true
					}
				}
			}
			return false
		}
		function init(configuration){
			config = configuration["core.io"] || {}
		}
		var requiredConfig = {
			proxyUrl: new gadgets.config.RegExValidator(/.*%(raw)?url%.*/),
			jsonProxyUrl: gadgets.config.NonEmptyStringValidator
		};
		//gadgets.config.register("core.io", requiredConfig, init);
		
		return {
			makeRequest: function(url, callback, opt_params){
				var params = opt_params || {};
				var httpMethod = params.METHOD || "GET";
				var refreshInterval = params.REFRESH_INTERVAL;
				var auth, st;
				if (params.AUTHORIZATION && params.AUTHORIZATION !== "NONE") {
					auth = params.AUTHORIZATION.toLowerCase();
					st = shindig.auth.getSecurityToken()
				}
				else {
					if (httpMethod === "GET" && refreshInterval === undefined) {
						refreshInterval = 3600
					}
				}
				var signOwner = true;
				if (typeof params.OWNER_SIGNED !== "undefined") {
					signOwner = params.OWNER_SIGNED
				}
				var signViewer = true;
				if (typeof params.VIEWER_SIGNED !== "undefined") {
					signViewer = params.VIEWER_SIGNED
				}
				var headers = params.HEADERS || {};
				if (httpMethod === "POST" && !headers["Content-Type"]) {
					headers["Content-Type"] = "application/x-www-form-urlencoded"
				}
				var urlParams = gadgets.util.getUrlParameters();
				var paramData = {
					url: url,
					httpMethod: httpMethod,
					headers: gadgets.io.encodeValues(headers, false),
					postData: params.POST_DATA || "",
					authz: auth || "",
					st: st || "",
					contentType: params.CONTENT_TYPE || "TEXT",
					numEntries: params.NUM_ENTRIES || "3",
					getSummaries: !!params.GET_SUMMARIES,
					signOwner: signOwner,
					signViewer: signViewer,
					gadget: urlParams.url,
					container: urlParams.container || urlParams.synd || "default",
					bypassSpecCache: gadgets.util.getUrlParameters().nocache || "",
					getFullHeaders: !!params.GET_FULL_HEADERS
				};
				if (auth === "oauth" || auth === "signed") {
					if (gadgets.io.oauthReceivedCallbackUrl_) {
						paramData.OAUTH_RECEIVED_CALLBACK = gadgets.io.oauthReceivedCallbackUrl_;
						gadgets.io.oauthReceivedCallbackUrl_ = null
					}
					
					// 変更箇所
					if (params && params.OAUTH_SERVICE_NAME) {
						paramData.oauthState = oauthState[ params.OAUTH_SERVICE_NAME] || "";
					} else {
						paramData.oauthState = "";
					}
					// 元
					//paramData.oauthState = oauthState || "";
					
					for (var opt in params) {
						if (params.hasOwnProperty(opt)) {
							if (opt.indexOf("OAUTH_") === 0) {
								paramData[opt] = params[opt]
							}
						}
					}
				}
				// 手当て
				var proxyUrl = "//%host%/gadgets/makeRequest".replace("%host%", document.location.host);
				// 元
				//var proxyUrl = config.jsonProxyUrl.replace("%host%", document.location.host);
				
				if (!respondWithPreload(paramData, params, callback, processResponse)) {
					if (httpMethod === "GET" && refreshInterval > 0) {
						var extraparams = "?refresh=" + refreshInterval + "&" + gadgets.io.encodeValues(paramData);
						makeXhrRequest(url, proxyUrl + extraparams, callback, null, "GET", params, processResponse)
					}
					else {
						makeXhrRequest(url, proxyUrl, callback, gadgets.io.encodeValues(paramData), "POST", params, processResponse)
					}
				}
			},
			makeNonProxiedRequest: function(relativeUrl, callback, opt_params, opt_contentType){
				var params = opt_params || {};
				makeXhrRequest(relativeUrl, relativeUrl, callback, params.POST_DATA, params.METHOD, params, processNonProxiedResponse, opt_contentType)
			},
			clearOAuthState: function(){
				// 変更箇所
				oauthState = {}
				// 元
				//oauthState = undefined
			},
			
			getOAuthState: function(){
				return oauthState
			},
			
			encodeValues: function(fields, opt_noEscaping){
				var escape = !opt_noEscaping;
				var buf = [];
				var first = false;
				for (var i in fields) {
					if (fields.hasOwnProperty(i) && !/___$/.test(i)) {
						if (!first) {
							first = true
						}
						else {
							buf.push("&")
						}
						buf.push(escape ? encodeURIComponent(i) : i);
						buf.push("=");
						buf.push(escape ? encodeURIComponent(fields[i]) : fields[i])
					}
				}
				return buf.join("")
			},
			getProxyUrl: function(url, opt_params){
				var params = opt_params || {};
				var refresh = params.REFRESH_INTERVAL;
				if (refresh === undefined) {
					refresh = "3600"
				}
				var urlParams = gadgets.util.getUrlParameters();
				var rewriteMimeParam = params.rewriteMime ? "&rewriteMime=" + encodeURIComponent(params.rewriteMime) : "";
				
				// 手当て
				var ret = "//www.gmodules.com/gadgets/proxy/refresh=%refresh%&container=%container%%rewriteMime%&gadget=%gadget%/%rawurl%".replace("%url%", encodeURIComponent(url)).replace("%host%", document.location.host).replace("%rawurl%", url).replace("%refresh%", encodeURIComponent(refresh)).replace("%gadget%", encodeURIComponent(urlParams.url)).replace("%container%", encodeURIComponent(urlParams.container || urlParams.synd || "default")).replace("%rewriteMime%", rewriteMimeParam);
				// 元
				//var ret = config.proxyUrl.replace("%url%", encodeURIComponent(url)).replace("%host%", document.location.host).replace("%rawurl%", url).replace("%refresh%", encodeURIComponent(refresh)).replace("%gadget%", encodeURIComponent(urlParams.url)).replace("%container%", encodeURIComponent(urlParams.container || urlParams.synd || "default")).replace("%rewriteMime%", rewriteMimeParam);
				if (ret.indexOf("//") == 0) {
					ret = window.location.protocol + ret
				}
				return ret
			}
		}
	}();
	gadgets.io.RequestParameters = gadgets.util.makeEnum(["METHOD", "CONTENT_TYPE", "POST_DATA", "HEADERS", "AUTHORIZATION", "NUM_ENTRIES", "GET_SUMMARIES", "GET_FULL_HEADERS", "REFRESH_INTERVAL", "OAUTH_SERVICE_NAME", "OAUTH_USE_TOKEN", "OAUTH_TOKEN_NAME", "OAUTH_REQUEST_TOKEN", "OAUTH_REQUEST_TOKEN_SECRET", "OAUTH_RECEIVED_CALLBACK"]);
	gadgets.io.MethodType = gadgets.util.makeEnum(["GET", "POST", "PUT", "DELETE", "HEAD"]);
	gadgets.io.ContentType = gadgets.util.makeEnum(["TEXT", "DOM", "JSON", "FEED"]);
	gadgets.io.AuthorizationType = gadgets.util.makeEnum(["NONE", "SIGNED", "OAUTH"]);
	
	tamings___ = [];
	tamings___.push(
		function(A){
			caja___.whitelistFuncs([
				[gadgets.io,"encodeValues"],[gadgets.io,"getProxyUrl"],[gadgets.io,"makeRequest"]
			])
		}
	);
	
	gadgets.io.preloaded_=[];
}
